package com.atguigu.gmallsugar.mapper;

import com.atguigu.gmallsugar.pojo.VisitStats;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VisitorStatsMapper {
    @Select("SELECT\n" +
        "    toHour(stt) AS hour,\n" +
        "    sum(pv_ct) AS pv,\n" +
        "    sum(uv_ct) AS uv,\n" +
        "    sum(uj_ct) AS uj\n" +
        "FROM visitor_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY toHour(stt)\n")
    List<VisitStats> statsByHour(int date);
}
